package moc.egg;
import moc.compiler.*;
import moc.tds.*;
import moc.type.*;
import moc.gc.*;
import java.util.*;
import moc.type.object.*;
import mg.egg.eggc.runtime.libjava.lex.*;
import mg.egg.eggc.runtime.libjava.*;
import mg.egg.eggc.runtime.libjava.messages.*;
import mg.egg.eggc.runtime.libjava.problem.IProblem;
import java.util.Vector;
public class S_ATTRIBUTS_MOC {
LEX_MOC scanner;
  S_ATTRIBUTS_MOC() {
    }
  S_ATTRIBUTS_MOC(LEX_MOC scanner, boolean eval) {
    this.scanner = scanner;
    this.att_eval = eval;
    this.att_scanner = scanner;
    }
int [] sync= new int[0];
  HashMap<String, ATTRIBUTE> att_sattributes;
  boolean att_eval;
  IMachine att_machine;
  HashMap<String, ATTRIBUTE> att_hattributes;
  int att_adatt;
  TDS att_tds;
  LEX_MOC att_scanner;
  private void regle80() throws Exception {

    //declaration
    S_TYPE_MOC x_2 = new S_TYPE_MOC(scanner,att_eval) ;
    T_MOC x_3 = new T_MOC(scanner ) ;
    T_MOC x_4 = new T_MOC(scanner ) ;
    S_ATTRIBUTS_MOC x_6 = new S_ATTRIBUTS_MOC(scanner,att_eval) ;
    //appel
if  (att_eval)      action_auto_inh_80(x_2, x_3, x_6);
    x_2.analyser() ;
    x_3.analyser(LEX_MOC.token_ident);
    x_4.analyser(LEX_MOC.token_pv);
if  (att_eval)      action_add_80(x_2, x_3, x_6);
    x_6.analyser() ;
if  (att_eval)      action_trans_80(x_2, x_3, x_6);
  }
  private void regle79() throws Exception {

    //declaration
    //appel
if  (att_eval)      action_sattributes_79();
  }
private void action_trans_80(S_TYPE_MOC x_2, T_MOC x_3, S_ATTRIBUTS_MOC x_6) throws Exception {
try {
// instructions
this.att_sattributes=x_6.att_sattributes;
}catch(RuntimeException e) {       att_scanner._interrompre(IProblem.Internal,att_scanner.getBeginLine(),ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,new Object[] { "MOC", "#trans","ATTRIBUTS -> TYPE ident pv #add ATTRIBUTS1 #trans ;"});
}
  }
private void action_auto_inh_80(S_TYPE_MOC x_2, T_MOC x_3, S_ATTRIBUTS_MOC x_6) throws Exception {
try {
// instructions
x_2.att_tds=this.att_tds;
x_6.att_tds=this.att_tds;
x_6.att_hattributes=this.att_hattributes;
x_2.att_machine=this.att_machine;
x_6.att_machine=this.att_machine;
}catch(RuntimeException e) {       att_scanner._interrompre(IProblem.Internal,att_scanner.getBeginLine(),ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,new Object[] { "MOC", "#auto_inh","ATTRIBUTS -> TYPE ident pv #add ATTRIBUTS1 #trans ;"});
}
  }
private void action_sattributes_79() throws Exception {
try {
// instructions
this.att_sattributes=this.att_hattributes;
}catch(RuntimeException e) {       att_scanner._interrompre(IProblem.Internal,att_scanner.getBeginLine(),ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,new Object[] { "MOC", "#sattributes","ATTRIBUTS -> #sattributes ;"});
}
  }
private void action_add_80(S_TYPE_MOC x_2, T_MOC x_3, S_ATTRIBUTS_MOC x_6) throws Exception {
try {
// locales
ATTRIBUTE loc_a;
// instructions
if ((this.att_hattributes.get(x_3.att_txt)==null)){
this.att_hattributes.put(x_3.att_txt,  new ATTRIBUTE(x_2.att_type, this.att_adatt));
x_6.att_adatt=this.att_adatt+x_2.att_type.getTaille();
}
else {
att_scanner._interrompre(IProblem.Semantic, att_scanner.getBeginLine(), IMOCMessages.id_Attribut_defini, MOCMessages.Attribut_defini,new Object[]{""+x_3.att_txt});

}
}catch(RuntimeException e) {       att_scanner._interrompre(IProblem.Internal,att_scanner.getBeginLine(),ICoreMessages.id_EGG_runtime_error, CoreMessages.EGG_runtime_error,new Object[] { "MOC", "#add","ATTRIBUTS -> TYPE ident pv #add ATTRIBUTS1 #trans ;"});
}
  }
  public void analyser () throws Exception {
    scanner.lit ( 1 ) ;
    switch ( scanner.fenetre[0].code ) {
      case LEX_MOC.token_acf : // 232
        regle79 () ;
      break ;
      case LEX_MOC.token_void : // 239
        regle80 () ;
      break ;
      case LEX_MOC.token_int : // 241
        regle80 () ;
      break ;
      case LEX_MOC.token_char : // 242
        regle80 () ;
      break ;
      case LEX_MOC.token_identc : // 278
        regle80 () ;
      break ;
      case LEX_MOC.token_bool : // 270
        regle80 () ;
      break ;
      case LEX_MOC.token_id : // 266
        regle80 () ;
      break ;
      default :
               scanner._interrompre(IProblem.Syntax, scanner.getBeginLine(), IMOCMessages.id_MOC_unexpected_token,MOCMessages.MOC_unexpected_token,new String[]{scanner.fenetre[0].getNom()});
    }
  }
  }
